﻿//using System;
//using System.Collections.Generic;
//using System.Text;
//using DCRF.Common.Primitive;
//using DCRF.Common.Interface;
//using System.Reflection;
//using System.Collections;
//using DCRF.Common.Collection;
//using DCRF.Common.Definition;

//namespace DCRF.Common.Support
//{
//    public class BlockEvent
//    {
//        private IBlockWeb parentWeb = null;
//        private string key = null;  //this is used when calling handlers (passed to the code)

//        public BlockEvent(IBlockWeb parent, string k)
//        {
//            parentWeb = parent;
//            key = k;
//            handlers = new ConnectorCollection(parent);
//        }

//        /// <summary>
//        /// Handlers can be Service or Interface type
//        /// </summary>
//        private ConnectorCollection handlers = null;


//        /// <summary>
//        /// Call given serviceName of the given block when this event is raised
//        /// </summary>
//        /// <param name="blockId"></param>
//        /// <param name="serviceName"></param>
//        /// <returns></returns>
//        public string AttachHandler(Guid blockId, string serviceName)
//        {
//            string tempKey = handlers.CreateConnector();
//            handlers[tempKey].Handle = blockId;
//            handlers[tempKey].ServiceName = serviceName;
//            handlers[tempKey].Tag = this.key;

//            return tempKey;
//        }

//        /// <summary>
//        /// Call given methodName of the given object when this event is raised.
//        /// </summary>
//        /// <param name="target"></param>
//        /// <param name="itemName"></param>
//        /// <returns></returns>
//        public string AttachHandler(IConnectorSubject handler)
//        {
//            string tempKey = handlers.CreateConnector();

//            handlers[tempKey].Target = handler;
//            handlers[tempKey].ServiceName = this.key;  //so handler will get the event that has fired its process method

//            return tempKey;
//        }

//        public void DetachHandler(string key)
//        {
//            handlers.DeleteConnector(key);
//        }

//        /// <summary>
//        /// Can we restrict calling this to the container of BlockEvent?
//        /// </summary>
//        /// <param name="args"></param>
//        public void Raise(params object[] args)
//        {
//            handlers.ProcessRequestAll(args);
//        }
//    }
//}

    